package day28_239;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @ClassName Solution
 * @Description 暴力超时
 * @Author clockTown
 * @Date 2021/6/6 18:55
 * @Version 1.0
 */
public class Solution {
    public static int[] maxSlidingWindow(int[] nums, int k) {
        //判断特例
        if (nums.length == 1 || k == 1){
            return nums;
        }


        int[] res = new int[nums.length - k + 1];
        for (int i = 0; i < nums.length - k + 1; i++) {
            int maxNum = nums[i];
            for (int j = i; j < i + k; j++) {
                maxNum = Math.max(nums[j], maxNum);
            }
            res[i] = maxNum;
        }
        return res;
    }

}
